home *** CD-ROM | disk | FTP | other *** search
Visual Basic user-defined control file | 1999-02-03 | 6.3 KB | 228 lines |
- VERSION 5.00
- Object = "{0BA686C6-F7D3-101A-993E-0000C0EF6F5E}#1.0#0"; "threed32.ocx"
- Begin VB.UserControl MayProgress
- Alignable = -1 'True
- ClientHeight = 720
- ClientLeft = 0
- ClientTop = 0
- ClientWidth = 6150
- ClipControls = 0 'False
- ScaleHeight = 720
- ScaleWidth = 6150
- Begin VB.VScrollBar Scroll
- Height = 165
- Left = 5880
- Max = 0
- TabIndex = 2
- Top = 120
- Width = 135
- End
- Begin Threed.SSPanel Barra
- Height = 165
- Index = 0
- Left = 720
- TabIndex = 0
- Top = 120
- Visible = 0 'False
- Width = 5055
- _Version = 65536
- _ExtentX = 8916
- _ExtentY = 291
- _StockProps = 15
- BackColor = 12632256
- BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
- Name = "Garamond"
- Size = 8.25
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- BevelOuter = 1
- RoundedCorners = 0 'False
- FloodType = 1
- End
- Begin VB.Label lbl
- AutoSize = -1 'True
- Caption = "Tarea 1"
- BeginProperty Font
- Name = "Garamond"
- Size = 8.25
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 180
- Index = 0
- Left = 120
- TabIndex = 1
- Top = 120
- Visible = 0 'False
- Width = 480
- End
- End
- Attribute VB_Name = "MayProgress"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = True
- Attribute VB_PredeclaredId = False
- Attribute VB_Exposed = False
- Option Explicit
- Dim colClaves As New Collection
- Dim colBarras As New Collection
- Dim colLbls As New Collection
- Dim colValores As New Collection
-
- Dim lClave As Double
-
- Const MODO_UNILINEA As Integer = 1
- Const MODO_MULTILINEA As Integer = 2
- Dim iModo As Integer
-
-
- Property Let Valor(lClave As Long, lValor As Long)
- Dim sClave As String
- sClave = "T" & lClave
- colValores.Remove sClave
- colValores.Add lValor, sClave
- colBarras(sClave).FloodPercent = colValores(sClave) * 100 / CLng(colBarras(sClave).Tag)
- End Property
-
- Public Sub Incrementa(lClave As Long)
- On Error Resume Next
- Dim sClave As String
- sClave = "T" & lClave
- Dim l As Long
- l = colValores(sClave)
- colValores.Remove sClave
- l = l + 1
- colValores.Add l, sClave
- colBarras(sClave).FloodPercent = colValores(sClave) * 100 / CLng(colBarras(sClave).Tag)
- End Sub
-
- Public Function MostrarProgreso(sCaption As String, lMaximo As Long) As Long
- lClave = lClave + 1
- Dim i As Integer
- i = lbl.UBound + 1
- Load lbl(i)
- Load Barra(i)
- Height = Height + Barra(0).Height
- If sCaption = "" Then
- lbl(i).Caption = " Tarea " & lClave & " "
- Else
- lbl(i).Caption = " " & sCaption & " "
- End If
- lbl(i).Top = lbl(i - 1).Top + Barra(0).Height
- Barra(i).Top = Barra(i - 1).Top + Barra(0).Height
- Barra(i).Tag = lMaximo
- Barra(i).FloodPercent = 0
- Barra(i).Visible = True
- lbl(i).Visible = True
- colBarras.Add Barra(i), "T" & lClave
- colLbls.Add lbl(i), "T" & lClave
- colValores.Add 0, "T" & lClave
- Redibuja
- MostrarProgreso = lClave
-
- End Function
-
- Public Function TerminarProgreso(lId As Long) As Boolean
- On Error Resume Next
- If lId < 1 Then Exit Function
- Unload colBarras("T" & lId)
- Unload colLbls("T" & lId)
- colBarras.Remove "T" & lId
- colLbls.Remove "T" & lId
- colValores.Remove "T" & lId
- Redibuja
- End Function
-
-
-
-
-
- Private Sub Redibuja()
- Dim i As Integer
- Dim sw As Single
- Dim bl As Single
- If colLbls.Count > 0 Then
- If Scroll.Value > colLbls.Count - 1 Then Scroll.Value = colLbls.Count - 1
- Scroll.Max = colLbls.Count - 1
- Else
- Scroll.Value = 0
- Scroll.Max = 0
- End If
-
- Select Case iModo
- Case MODO_MULTILINEA
- Height = colLbls.Count * Barra(0).Height
- Scroll.Visible = False
- sw = 0
- For i = 1 To colLbls.Count
- bl = IIf(colLbls(i).Width > 2000, colLbls(i).Width, 2000)
- colLbls(i).Left = 0
- colBarras(i).Left = bl
- colBarras(i).Width = Width - bl - sw
- colBarras(i).Top = (i - 1) * Barra(0).Height
- colLbls(i).Top = (i - 1) * Barra(0).Height
- Next
- Case MODO_UNILINEA
- Height = Barra(0).Height
- If colLbls.Count > 1 Then
- sw = Scroll.Width
- Scroll.Visible = True
- Else
- sw = 0
- Scroll.Visible = False
- End If
- Scroll.Left = Width - sw
- For i = 1 To colLbls.Count
- bl = IIf(colLbls(i).Width > 2000, colLbls(i).Width, 2000)
- colLbls(i).Left = 0
- colBarras(i).Left = bl
- colBarras(i).Width = Width - bl - sw
- colBarras(i).Top = (i - 1 - Scroll.Value) * Barra(0).Height
- colLbls(i).Top = (i - 1 - Scroll.Value) * Barra(0).Height
- Next
- End Select
- End Sub
-
- Private Sub Barra_Click(Index As Integer)
- If iModo = MODO_MULTILINEA Then
- iModo = MODO_UNILINEA
- Else
- iModo = MODO_MULTILINEA
- End If
- Redibuja
- End Sub
-
- Private Sub Scroll_Change()
- Redibuja
- End Sub
-
- Private Sub UserControl_Initialize()
- iModo = MODO_MULTILINEA
- lbl(0).Top = -Barra(0).Height
- Barra(0).Top = -Barra(0).Height
- Height = 0
- Scroll.Top = 0
- End Sub
-
-
- Private Sub UserControl_Resize()
- Redibuja
- End Sub
-
- Private Sub UserControl_Terminate()
- Dim i As Integer
- For i = 1 To colLbls.Count
- Unload colLbls(i)
- Unload colBarras(i)
- Next
- Set colBarras = Nothing
- Set colLbls = Nothing
- Set colValores = Nothing
- End Sub
-